package com.shuigu.handler;

import com.shuigu.exception.ServiceException;
import com.shuigu.response.ShuiGuResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class SysGlobalExceptionHandler {

    @ExceptionHandler
    public ShuiGuResult exceptionHandler(ServiceException se){
        log.error("异常信息：{}", se.getMessage());
        return ShuiGuResult.error(se.getMessage());
    }
}
